import { Language } from "../../../../extend/language/Language";
type int = number;
//class RemainTimeTool
    
    export  class RemainTimeTool
    {
        

        public static getRemainTimeBySeconds(arg1: number, arg2: Boolean=true, arg3: Boolean=false): string
        {
            var loc5=NaN;
            var loc1="";
            var loc2=0;
            var loc3=0;
            var loc4=0;
            loc2 = (loc2 = arg1 / secondsPerHour) < 0 ? 0 : loc2;
            loc3 = (loc3 = (loc5 = arg1 % RemainTimeTool.secondsPerHour) / 60) < 0 ? 0 : loc3;
            loc4 = (loc4 = loc5 % 60) < 0 ? 0 : loc4;
            if (!arg3 && arg2) 
            {
                loc1 = RemainTimeTool.formatString(loc2) + ":" + RemainTimeTool.formatString(loc3) + ":" + RemainTimeTool.formatString(loc4);
            }
            else if (arg3) 
            {
                if (arg3) 
                {
                    if (loc2 > 0) 
                    {
                        loc1 = loc1 + Language.getStringByParam(90230, loc2 != 0 ? loc2 : "");
                    }
                    if (loc3 > 0) 
                    {
                        loc1 = loc1 + Language.getStringByParam(90231, loc2 == 0 && loc3 == 0 ? "" : loc3);
                    }
                    loc1 = loc1 + Language.getStringByParam(90232, loc4.toString());
                }
            }
            else 
            {
                loc1 = RemainTimeTool.formatString(loc3) + ":" + RemainTimeTool.formatString(loc4);
            }
            return loc1;
        }

        /* internal  */static formatString(arg1: int): string
        {
            var loc1=null;
            if (arg1 < 0) 
            {
                return "00";
            }
            if (arg1 <= 9) 
            {
                loc1 = "0" + arg1;
            }
            else 
            {
                loc1 = arg1.toString();
            }
            return loc1;
        }

        public static getRemainTimeByMillisecond(arg1: number, arg2: string, arg3: string, arg4: int): string
        {
            var loc3=NaN;
            var loc4=0;
            var loc5=NaN;
            var loc6=0;
            var loc7=0;
            var loc1="";
            var loc2=0;
            if (arg1 > 0) 
            {
                loc2 = int(arg1 / secondsPerDay);
                loc3 = arg1 % RemainTimeTool.secondsPerDay;
                loc4 = int(loc3 / secondsPerHour);
                loc5 = loc3 % RemainTimeTool.secondsPerHour;
                loc6 = int(loc5 / 60);
                loc7 = loc5 % 60;
                if (loc2 > 0) 
                {
                    loc1 = loc1 + ("<font color=\'" + arg2 + "\' size=\'" + arg4 + "\'>" + loc2 + "</font><font color=\'" + arg3 + "\'>" + Language.getString(53023) + "</font>");
                }
                loc1 = (loc1 = (loc1 = loc1 + ("<font color=\'" + arg2 + "\' size=\'" + arg4 + "\'>" + loc4 + "</font><font color=\'" + arg3 + "\'>" + Language.getString(90275) + "</font>")) + ("<font color=\'" + arg2 + "\' size=\'" + arg4 + "\'>" + loc6 + "</font><font color=\'" + arg3 + "\'>" + Language.getString(90276) + "</font>")) + ("<font color=\'" + arg2 + "\' size=\'" + arg4 + "\'>" + loc7 + "</font><font color=\'" + arg3 + "\'>" + Language.getString(90277) + "</font>");
            }
            return loc1;
        }

        /* internal */ static /* const */secondsPerHour: int=60 * 60;

        public static /* var */secondsPerDay: int=86400;
    }

            RemainTimeTool.secondsPerDay = 60 * 60 * 24;
        